package controllers;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

import models.Plan;



public class OrderPlanByRating implements Comparator<Plan> {

	@Override
	public int compare(Plan u1, Plan u2) {
		if(u1.planRating < u2.planRating)
			return -1;
		if(u1.planRating > u2.planRating)
			return 1;
		return 0;
	}


	public static void sort(ArrayList<Plan> plans){
		Collections.sort(plans, new OrderPlanByRating());
	}

}